home *** CD-ROM | disk | FTP | other *** search
- /*
- name: platform.c
-
- Misc. generic platform specific code
- ------------------------------------
-
-
- This source-code is part of the RayLab 1.1 package, and it is provided
- for your compiling pleasure. You may use it, change it, re-compile it
- etc., as long as nobody else but you receive the changes/compilations
- that you have made!
-
- You may not use any part(s) of this source-code for your own productions
- without the permission from the author of RayLab. Please read the legal
- information found in the users documentation for RayLab for more details.
-
- */
-
-
- #include <stdio.h>
- #include <signal.h>
-
- #include "defs.h"
- #include "extern.h"
-
-
- void BreakHandler(int SigNum);
- void FPErrHandler(int SigNum);
- void SEGErrHandler(int SigNum);
-
-
-
- /******************************************************************
- *
- * InitPlatform()
- *
- ******************************************************************/
-
- void InitPlatform(void)
- {
- textoutput = stderr; /* Use stderr for text output */
-
- /* Install break-handlers */
- (void) signal(SIGINT, (void *)BreakHandler);
- (void) signal(SIGTERM, (void *)BreakHandler);
- (void) signal(SIGFPE, (void *)FPErrHandler);
- (void) signal(SIGSEGV, (void *)SEGErrHandler);
- }
-
-
- /******************************************************************
- *
- * CloseDownPlatform()
- *
- ******************************************************************/
-
- void CloseDownPlatform(void)
- {
-
- }
-
-
- /******************************************************************
-
- Interrupt handlers
-
- ******************************************************************/
-
- /* This routine is called if CTRL-C is issued */
-
- void BreakHandler(int SigNum)
- {
- fprintf(textoutput,"\n*** RayLab was interrupted. Closing down...\n");
- cleanup();
- exit(1);
- }
-
- /* This routine is called in the case of a floating point error */
-
- void FPErrHandler(int SigNum)
- {
- fprintf(textoutput,"\n*** Floating point error. Closing down...\n");
- cleanup();
- exit(1);
- }
-
- /* This routine is called in the case of a segmentation violation */
-
- void SEGErrHandler(int SigNum)
- {
- fprintf(textoutput,"\n*** Segmentation error. Closing down...\n");
- cleanup();
- exit(1);
- }
-